import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../utils/layout/layout_responsive.dart';
import '../../utils/G.dart';

class HomeMenus extends StatelessWidget {
  List menuList;
  HomeMenus({Key? key, required List this.menuList}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    // print('首页菜单');
    // print(menuList);
    return Wrap(
      direction: Axis.horizontal,
      alignment: WrapAlignment.spaceBetween,
      children: _renderMenus(),
    );
  }

  List<Widget> _renderMenus() {
    return menuList.map((item) {
      return Container(
          margin: const EdgeInsets.fromLTRB(0, 10, 0, 0),
          width: G.width / 4,
          child: InkWell(
              onTap: () {},
              child: Flex(
                direction: Axis.vertical,
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Image.network(
                    item['img'],
                  ),
                  // G.imageWidget(item['img'], width: 120.w, height: 120.h),
                  Text(item['info'].first['value'],
                      textAlign: TextAlign.center,
                      style: const TextStyle(fontSize: 14))
                ],
              )));
    }).toList();
  }
}
